/**
 * Copyright (C) 2017 PatSnap Pte Ltd, All Rights Reserved.
 */
package com.job.controller;


import com.job.bean.Comment;
import com.job.service.CommentService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: Tory
 * Date: 4/8/17
 * Time: 7:36 PM
 */
@RequestMapping(value = "/comment")
@RestController
public class CommentController {

    @Autowired
    private CommentService commentService;

    @PostMapping
    public void save(@RequestBody Comment comment) {
        commentService.save(comment);
    }

    @GetMapping
    public ResponseEntity getGoodList() {
        return ResponseEntity.ok(commentService.findAll());
    }

    @DeleteMapping(value = "/{id}")
    public void delete(@PathVariable Integer id) {
        commentService.delete(id);
    }
}
